package com.eascs.workflow.common.service;

import javax.inject.Inject;

import org.springframework.stereotype.Service;

import com.eascs.app.dao.PageResult;
import com.eascs.app.dao.mongo.MongoPageQuery;
import com.eascs.workflow.common.dao.ProxyMongoDao;

@Service
public class ProxyMongoService {

	@Inject
	private ProxyMongoDao proxyMongoDao;

	public ProxyMongoDao getProxyMongoDao() {
		return proxyMongoDao;
	}

	public void setProxyMongoDao(ProxyMongoDao proxyMongoDao) {
		this.proxyMongoDao = proxyMongoDao;
	}

	public <T> T findOne(Class<T> entityClass, String keyName, Object keyValue) {
		return proxyMongoDao.findOne(entityClass, keyName, keyValue);
	}

	public <T> T findOne(Class<T> entityClass, Object id) {
		return proxyMongoDao.findOne(entityClass, id);
	}

	public <T> T deleteOne(Class<T> entityClass, Object id) {
		return proxyMongoDao.deleteOne(entityClass, id);
	}

	public <T> void update(T entity) {
		proxyMongoDao.update(entity);
	}

	public <T> void replace(T entity) {
		proxyMongoDao.replace(entity);
	}

	public <T> void insert(T entity) {
		proxyMongoDao.insert(entity);
	}

	public <T> PageResult<T> findDataWithPage(MongoPageQuery<T> sqlPageQuery) {
		return proxyMongoDao.findDataWithPage(sqlPageQuery);
	}

}
